﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace BanXeTang
{
    public class MySprite
    {
        public MySprite(Texture2D[] _inputtexture2d, float _inputx, float _inputy)
        {
            texture2d = _inputtexture2d;
            x = _inputx;
            y = _inputy;
            itexture2d = 0;
        }
       

        private Texture2D[] _texture2d;

        public Texture2D[] texture2d
        {
            get { return _texture2d; }
            set
            {
                _texture2d = value;
                _ntexture2d = _texture2d.Length;
            }
        }
        private int _ntexture2d;

        public int ntexture2d
        {
            get { return _ntexture2d; }
            set { _ntexture2d = value; }
        }

        private float _x;

        public float x
        {
            get { return _x; }
            set { _x = value; }
        }
        private float _y;

        public float y
        {
            get { return _y; }
            set { _y = value; }
        }

        public int _itexture2d;

        protected int itexture2d
        {
            get { return _itexture2d; }
            set { _itexture2d = value; }
        }

        public void Update(GameTime gameTime)
        {
            _itexture2d = (_itexture2d + 1) % _ntexture2d;
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Color color)
        {
            spriteBatch.Draw(_texture2d[_itexture2d], new Vector2(_x + GlobalSettings._DeltaX, _y + GlobalSettings._DeltaY), color);

        }
        public Rectangle getBound()
        {
            return new Rectangle((int)x, (int)y, texture2d[0].Width, texture2d[0].Height);
        }
        public bool CheckCollisions(MySprite ms)
        {
            return getBound().Intersects(ms.getBound());
        }
    }
}
